package org.bhujmandir.android;

import org.bhujmandir.android.utils.MyApplication;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;


public class Main extends Activity{
	Context context;
	ListView headingsView;
	TextView title;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		context = this;
		setContentView(R.layout.main);
		
		title = (TextView)findViewById(R.id.title);
		title.setVisibility(8);  //Set visibility to gone

		
		String[] headings = getResources().getStringArray(R.array.headings);
		headingsView = (ListView)findViewById(R.id.listView);
		headingsView.setAdapter(new ArrayAdapter<String>(context,R.layout.std_list_item,headings));

		headingsView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				String item = (((TextView) view).getText()).toString();
				if("Music".equals(item))	{
		    		 Intent i = new Intent(context,MusicActivity.class);	
		    		 startActivity(i); 
		    		 Log.v(MyApplication.TAG,"in ");
		    	 }else{
		    		 Log.v(MyApplication.TAG,"Error");
		    		 // TODO Add other activities to launch for on click
		    	 }
		     }
		   });
		   
	}
	
	
}

